import java.util.Scanner;

public class Demo {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        char[] s = in.next().toCharArray();

        StringBuilder st = new StringBuilder();
        for (int i = 0; i < s.length; i++) {
            char x = s[i];
            if (st.length() != 0 && x == st.charAt(st.length() - 1)){
                st.deleteCharAt(st.length() - 1);
            }else {
                st.append(x);
            }
        }
        System.out.println(st.length() == 0 ? 0 :st.toString());
    }
}
